import api from '@/api/helper'
/**
* products
* @param input
* @returns
*/
export const products = async(input:ProductSearch) => {
    var result = await api.post<Result<ProductSearchOut>>(`product/products`, input);
    if (api.check(result))
    {
        return result.data;
    }
    return null;
}
/**
* realDelete
* @param id:string
* @returns
*/
export const realDelete = async(id:string) => {
    var result = await api.post<Result<string>>(`product/${id}/real-delete`, {});
    if (api.check(result))
    {
        return result.data;
    }
    return null;
}
/**
* get
* @param id:string
* @returns
*/
export const get = async(id:string) => {
    var result = await api.get<Result<ProductOut>>(`product/${id}`, {});
    if (api.check(result))
    {
        return result.data;
    }
    return null;
}
/**
* edit
* @param input
* @returns
*/
export const edit = async(input:ProductOut) => {
    var result = await api.post<Result<string>>(`product/edit`, input);
    if (api.check(result))
    {
        return result.data;
    }
    return null;
}
/**
* get
* @param key:string
* @returns
*/
export const getGet = async(key:string) => {
    var result = await api.get<Result<ProductOut>>(`product`, { 'key':key });
    if (api.check(result))
    {
        return result.data;
    }
    return null;
}
